home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / misc / WHDLoaddev.lha / WHDLoad / Src / sources / stfix.s < prev   
Text File  |  1997-08-31  |  1KB  |  51 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    stfix.s
  3. ;  :Contents.    routine to fix the old soundtracker playback routine
  4. ;        this old routine used in many games and demos contains an
  5. ;        empty dbf loop which wont work correctly on faster machines
  6. ;        the dbf loop will be replaced by a wait based on the vertical
  7. ;        raster position
  8. ;  :History.    30.08.97 extracted from slave sources
  9. ;  :Requires.    -
  10. ;  :Copyright.    Public Domain
  11. ;  :Language.    68000 Assembler
  12. ;  :Translator.    Barfly V1.131
  13. ;  :To Do.
  14. ;---------------------------------------------------------------------------*
  15. ;
  16. ; bad stuff (contained 2 times):
  17. ;        move.w    #$12c,d0    ;303c 012c
  18. ;    .loop    dbf    d0,.loop    ;51c8 fffe
  19. ;
  20. ; the routine will scan the given memory area and patch the bad stuff
  21. ;
  22. ; IN:    A0 = APTR start of memory to patch
  23. ;    A1 = APTR end of memory to patch
  24. ; OUT:    d0-d1/a0-a1 destroyed
  25.  
  26. _stfix        subq.l    #7,a1
  27. .s0        cmp.w    #$303c,(a0)
  28.         bne    .s1
  29.         cmp.w    #$012c,(2,a0)
  30.         bne    .s1
  31.         cmp.l    #$51c8fffe,(4,a0)
  32.         bne    .s1
  33.         move.w    #$4eb9,(a0)+        ;JSR xxxxxxxx.L
  34.         pea    (.wait,pc)
  35.         move.l    (a7)+,(a0)
  36. .s1        addq.l    #2,a0
  37.         cmp.l    a0,a1
  38.         bhi    .s0
  39.         rts
  40.  
  41. .wait        move.l    d1,-(a7)
  42.         moveq    #8,d1            ;8.5 * 63.5µs = 0.54 ms
  43. .1        move.b    $dff006,d0
  44. .2        cmp.b    $dff006,d0
  45.         beq    .2
  46.         dbf    d1,.1
  47.         move.l    (a7)+,d1
  48.         addq.l    #2,(a7)
  49.         rts
  50.  
  51.